cus_list=[
    {'card':'11111111','password':'999999','name':'zhangsan','amount':'1000'},
    {'card':'22222222','password':'888888','name':'lisi','amount':'2000'},
    {'card':'33333333','password':'777777','name':'wangwu','amount':'5000'}]


def log_in():
    print('='*20,'欢迎！请输入账号、密码','='*20)
    a=input('账号：')
    b=input('密码：')
    for cus_dict in cus_list:
        if cus_dict['card']==a and cus_dict['password']==b:
            while True:
                print('='*20,'欢迎办理业务','='*20)
                print('{:1}{:13}{:15}'.format(' ','1.查询余额','2.存款'))
                print ( '{:1}{:13}{:15}'.format ( ' ', '3.取款', '4.退出' ) )
                print('='*40)
                key = input('请输入您要办理的业务：')

                if key == '1':
                    print ( '=' * 20, '存款信息浏览', '=' * 20 )
                    if len ( cus_list ) == 0:
                        print ( '=' * 20, '没有客户信息', '=' * 20 )
                        return

                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format ( 'card', 'name', 'amount' ) )
                    print ( '-' * 40 )
                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format(cus_dict['card'],cus_dict['name'],cus_dict['amount']))
                    input ( '按回车继续：' )

                elif key =='2':
                    print('='*20,'请输入您想存入的金额','='*20)
                    c=input('金额:')
                    cus_dict['amount']=int(cus_dict['amount'])+int(c)
                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format ( 'card', 'name', 'amount' ) )
                    print ( '-' * 40 )
                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format ( cus_dict['card'], cus_dict['name'], cus_dict['amount'] ) )
                    input ( '按回车继续：' )

                elif key =='3':
                    print('='*20,'请输入您想存入的金额','='*20)
                    c=input('金额:')
                    cus_dict['amount']=int(cus_dict['amount'])-int(c)
                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format ( 'card', 'name', 'amount' ) )
                    print ( '-' * 40 )
                    print ( '{0:<10}|{1:<10}|{2:<10}|'.format ( cus_dict['card'], cus_dict['name'], cus_dict['amount'] ) )
                    input ( '按回车继续：' )

                elif key == '4':
                    pass
                    print ( '=' * 12, '再见', '=' * 12 )
                    break

                else:
                    print ( '=' * 12, '操作无效', '=' * 12 )

        else:
            return

log_in()






